#ifndef __MY_SETTING_H
#define __MY_SETTING_H

#include "stm32f10x.h"
#include "data_holder.h"

#ifndef PI
#define PI 3.141592654
#endif

class MySetting{

    private:
        MySetting();
    
    public:
        static MySetting* get(void)
        {
            static MySetting st;
            return &st;
        }
        
    public:
        short motor_direction[3];   //2个轮子的朝向, 为了好理解，用1~2的下标
        double ratio;               //减速比
        double wheel_diameter;      //轮子直径
        double max_speed;           //最大行驶速度
        double encoder_wheel_d;     //从动轮轮子直径
        double encoder_direction;   //编码器方向
        double sample_interveal;    //采样周期
        double max_d_turn;          //最大圈数变化量
    
    public:
        double getMaxDturn(uint32_t dt_ms)
        {
            double d_turn;          //最大圈数变化量
            const double k = 1.5;       //k是可靠系数
            d_turn = max_speed * dt_ms / 1000.0 / (PI * encoder_wheel_d) * k;
            return d_turn;
        }

};

#endif
